home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 October / CHIP Turkiye Ekim 2000.iso / prog / basic / 07 / setup.exe / %MAINDIR% / sample2.bat < prev    next >
Encoding:
DOS Batch File  |  2000-05-02  |  1.2 KB  |  38 lines

  1.   @echo off
  2.  
  3. ::**********************************************************************
  4. :: Demonstrates using a batch file to script GetRight.
  5. :: Shows saving older copies of the file being repeatedly downloaded.
  6. ::
  7. :: You must use START /W if you use the /W parameter in GetRight so
  8. :: that a Windows DOS prompt will really wait until everything finishes 
  9. :: to continue with the batch file.
  10. ::**********************************************************************
  11.  
  12. ::*** See if the file already exists.
  13. ::*** Uses the fact that GetRight adds .GetRight to the name until the file is done.
  14. if not exist c:\backup.bck goto DOWNLOAD_IT
  15.  
  16. ::*** Does exist, so get rid of oldest and move other copies back before re-downloading.
  17. del c:\backup.bck.5
  18. ren c:\backup.bck.4 c:\backup.bck.5
  19. ren c:\backup.bck.3 c:\backup.bck.4
  20. ren c:\backup.bck.2 c:\backup.bck.3
  21. ren c:\backup.bck.1 c:\backup.bck.2
  22. ren c:\backup.bck   c:\backup.bck.1
  23.  
  24.  
  25. :DOWNLOAD_IT
  26. ::*** Download the file...
  27. start /w GETRIGHT.EXE /url:"ftp://www.xyz.com/backup.bck" /file:"c:\backup.bck" /w
  28.  
  29.  
  30. ::*** Check if file exists to give OK or fail msg.
  31. if exist c:\backup.bck goto DONE_DOWNLOAD
  32.   echo ERROR:  Download Failed!
  33.   goto EXIT
  34. :DONE_DOWNLOAD
  35.   echo Downloaded OK!
  36.  
  37.  
  38. :EXIT